package jp.co.baka.html5.controller.table;

import java.util.ArrayList;
import java.util.List;

import org.slim3.controller.Controller;
import org.slim3.controller.Navigation;

public class Table2Controller extends Controller {

    @Override
    public Navigation run() throws Exception {

        int recordNum=1000;

        Table2Controller.crearCount();

        List<LineDto> dataList = new ArrayList<LineDto>();
        for(int i=0;i<recordNum;i++){

            LineDto line = new LineDto();
            dataList.add(line);

        }


        requestScope("dataList", dataList);


        return forward("table2.jsp");
    }


    private static int count = 1;
    private static int incrementCount(){
        return count++;
    }
    private static void crearCount(){
        count = 1;
    }

    public static class LineDto{

        private String str1;
        private String str2;
        private String str3;
        private String str4;
        private String str5;
        private String str6;
        private String str7;



        public LineDto() {


            this.str1=Integer.toString(Table2Controller.incrementCount());
            this.str2=createRandomStr("い");
            this.str3=createRandomStr("う");
            this.str4=createRandomStr("え");
            this.str5=createRandomStr("お");
            this.str6=createRandomStr("か");
            this.str7=createRandomStr("き");



        }




        public String createRandomStr(String s){

            Double d = Math.random() * 10;
            int size= d.intValue();

            StringBuffer buf = new StringBuffer(s);
            for(int i=0;i<size;i++){
                buf.append(s);
            }


            return buf.toString();
        }





        public String getStr1() {
            return str1;
        }
        public void setStr1(String str1) {
            this.str1 = str1;
        }
        public String getStr2() {
            return str2;
        }
        public void setStr2(String str2) {
            this.str2 = str2;
        }
        public String getStr3() {
            return str3;
        }
        public void setStr3(String str3) {
            this.str3 = str3;
        }
        public String getStr4() {
            return str4;
        }
        public void setStr4(String str4) {
            this.str4 = str4;
        }
        public String getStr5() {
            return str5;
        }
        public void setStr5(String str5) {
            this.str5 = str5;
        }
        public String getStr6() {
            return str6;
        }
        public void setStr6(String str6) {
            this.str6 = str6;
        }
        public String getStr7() {
            return str7;
        }
        public void setStr7(String str7) {
            this.str7 = str7;
        }




    }



}
